#include <iostream>
#include <vector>
using namespace std;
const int N=1e3+10;
vector<pair<int,int>> edge[N];
bool flg=false;
int vis[N];
int retHot,retCut=0x3f3f;
int n,m,s,t;
vector<int> hot;
void dfs(int pos,int maxHot,int sumCut)
{
	if(sumCut>retCut)
		return;
	if(sumCut==retCut && maxHot>retHot)
		return ;
	if(pos==t)
	{
		retHot=maxHot;
		retCut=sumCut;
		flg=true;
		return ;
	}
	for(int i=0;i<edge[pos].size();i++)
	{
		int num=edge[pos][i].first;
		int cut=edge[pos][i].second;
		if(!vis[num])
		{
			vis[num]=1;
			dfs(num,max(hot[num],maxHot),sumCut+cut);
			vis[num]=0;
		}
	}
}
int main()
{
	
	cin>>n>>m>>s>>t;
	hot.resize(n+1);
	
	for(int i=1;i<=n;i++)
		cin>>hot[i];
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		cin>>a>>b>>c;
		edge[a].push_back({b,c});
		edge[b].push_back({a,c});
	}
	vis[s]=1;
	dfs(s,0,0);
	if(flg)
	{
		cout<<retCut<<' '<<retHot<<endl;
	}
	else{
		cout<<"Impossible"<<endl;
	}
	return 0;
}

//7->3  30
//
